package com.mq.control;

import com.mq.bean.User;
import com.mq.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * TODO 增加注释
 *
 * @author MangoG
 * @version 1.0
 * @since 2018-02-03 15:45:11
 */
@Controller
@RequestMapping("/user/")
public class UserControl {

    @Autowired
    private IUserService service;

    @RequestMapping("save")
    public void save(User user) {
        this.service.save(user);
    }

    @RequestMapping("update")
    public void update(User user) {
        this.service.update(user);
    }

    @RequestMapping("get")
    @ResponseBody
    public User get(Long id) {
        return this.service.get(id);
    }

    @RequestMapping("list")
    @ResponseBody
    public List<User> list() {
        return this.service.list();
    }

    @RequestMapping("del")
    public void del(Long id) {
        this.service.del(id);
    }
}
